package com.greatwqs.wmall.user.provider.model.po;

import java.util.Date;

import com.greatwqs.wmall.user.provider.model.dto.UserRegisterDto;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * Created by MyBatis Generator 2025/04/01
 * https://github.com/greatwqs/mybatis-generator-plugin
 */
@Getter
@Setter
@ToString
public class User {
    private Long userId;

    private String userName;

    private String loginId;

    private String userPwd;

    private String phoneNo;

    private String emailAdd;

    private String userImg;

    private Integer userStatus;

    private Boolean valid;

    private Date createTime;

    private Date updateTime;

    public static User register(UserRegisterDto dto) {
        User user = new User();
        user.setUserId(null);
        user.setLoginId(dto.getLoginId());
        user.setUserPwd(dto.getPassword());
        user.setUserName("New user");
        user.setPhoneNo("");
        user.setEmailAdd("");
        user.setUserImg("");
        user.setUserStatus(1);
        user.setValid(true);
        user.setCreateTime(new Date());
        user.setUpdateTime(new Date());
        return user;
    }
}